<script>
  if (!Date.prototype.format) {
    /**
     * @param {} fmt yyyy-MM-dd hh:mm:ss.S qq
     */
    Date.prototype.format = function (fmt = 'yyyy-MM-dd') {
      var o = {
        "y+": this.getFullYear(),     //年份
        "M+": this.getMonth() + 1,    //月份
        "d+": this.getDate(),         //日
        "h+": this.getHours(),        //小时
        "m+": this.getMinutes(),      //分
        "s+": this.getSeconds(),      //秒
        "S": this.getMilliseconds(),  //毫秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
      }
      if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))
      }
      for (var k in o) {
        if (new RegExp("(" + k + ")").test(fmt)) {
          fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
        }
      }
      return fmt
    }
  }

  console.log('UTC', Date.UTC(96, 11, 1, 0, 0, 0))
  console.log('now', Date.now())
  console.log('parse', Date.parse('Wed, 09 Aug 1995 00:00:00 GMT'))
  console.log('getDate', new Date().getDate())
  console.log('getDay', new Date().getDay())
  console.log('getFullYear', new Date().getFullYear())
  console.log('getHours', new Date().getHours())
  console.log('getMilliseconds', new Date().getMilliseconds())
  console.log('getMinutes', new Date().getMinutes())
  console.log('getMonth', new Date().getMonth())
  console.log('getSeconds', new Date().getSeconds())
  console.log('getTime', new Date().getTime())
  console.log('getTimezoneOffset', new Date().getTimezoneOffset())
  console.log('getUTCDate', new Date().getUTCDate())
  console.log('getUTCDay', new Date().getUTCDay())
  console.log('getUTCFullYear', new Date().getUTCFullYear())
  console.log('getUTCHours', new Date().getUTCHours())
  console.log('getUTCMilliseconds', new Date().getUTCMilliseconds())
  console.log('getUTCMinutes', new Date().getUTCMinutes())
  console.log('getUTCMonth', new Date().getUTCMonth())
  console.log('getUTCSeconds', new Date().getUTCSeconds())
  console.log('setDate', new Date().setDate())
  console.log('setFullYear', new Date().setFullYear())
  console.log('setHours', new Date().setHours())
  console.log('setMilliseconds', new Date().setMilliseconds())
  console.log('setMinutes', new Date().setMinutes())
  console.log('setMonth', new Date().setMonth())
  console.log('setSeconds', new Date().setSeconds())
  console.log('setTime', new Date().setTime())
  console.log('setUTCDate', new Date().setUTCDate())
  console.log('setUTCFullYear', new Date().setUTCFullYear())
  console.log('setUTCHours', new Date().setUTCHours())
  console.log('setUTCMilliseconds', new Date().setUTCMilliseconds())
  console.log('setUTCMinutes', new Date().setUTCMinutes())
  console.log('setUTCMonth', new Date().setUTCMonth())
  console.log('setUTCSeconds', new Date().setUTCSeconds())
  console.log('setYear', new Date().setYear())
  console.log('toDateString', new Date().toDateString())
  console.log('toGMTString', new Date().toGMTString())
  console.log('toISOString', new Date().toISOString())
  console.log('toJSON', new Date().toJSON())
  console.log('toLocaleDateString', new Date().toLocaleDateString())
  console.log('toLocaleString', new Date().toLocaleString())
  console.log('toLocaleTimeString', new Date().toLocaleTimeString())
  // console.log('toSource', new Date().toSource())
  console.log('toString', new Date().toString())
  console.log('toTimeString', new Date().toTimeString())
  console.log('toUTCString', new Date().toUTCString())
  console.log('valueOf', new Date().valueOf())
  console.log('format', new Date().format('yyyy-MM-dd hh:mm:ss.S qq'))



  function getTimeByTimeZone(timeZone) {
    var d = new Date();
    localTime = d.getTime(),
      localOffset = d.getTimezoneOffset() * 60000, //获得当地时间偏移的毫秒数,这里可能是负数  
      utc = localTime + localOffset, //utc即GMT时间  
      offset = timeZone, //时区，北京市+8  美国华盛顿为 -5  
      localSecondTime = utc + (3600000 * offset);  //本地对应的毫秒数  
    var date = new Date(localSecondTime);
    console.log("根据本地时间得知" + timeZone + "时区的时间是 " + date.toLocaleString());
    console.log("系统默认展示时间方式是：" + date)
  }

  getTimeByTimeZone(8)

  console.log('2018-03-02T01:20:53.985Z'.replace(/\-/g, '/').replace(/T/g, ' ').replace(/\.+[0-9]+[A-Z]$/, ''))

</script>